import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
import createPersistedState from "vuex-persistedstate"
import $axios from "../api/request";
const store = new Vuex.Store({
  plugins: [createPersistedState({
    storage: window.sessionStorage,
  })],
  state: {
      phone:'',
      token:'',
      address:[],
   
  },
  mutations: {
    set_phone(state,payload){
        state.phone = payload
    },
    set_token(state,payload){
        state.token = payload
    },
    set_address(state,payload){
      state.address=payload
    },
  },
  actions: {
    LOGOUT(store,payload){
      store.commit('set_phone','');
      store.commit('set_token','');
    }
  }
 
});
export default store;
